import QtQuick 2.12
import QtQuick.Window 2.12
import QtGraphicalEffects 1.13
import QtQuick.Controls 2.5


import EUIpackage 1.0
import EControl 1.0

import "./showpage"

Window {
    visible: true
    width: 1440
    height: 900
    maximumWidth: 1440
    maximumHeight: 900
    minimumWidth: 1440
    minimumHeight: 900
    title: qsTr("JanQuick_Eui")

    Rectangle{
        id:mainIconArea
        width: 210
        height: 56
        color: "#334154"
        Text {
            text: qsTr("JanQuick_Eui")
            width: contentWidth
            height: contentHeight
            font.pixelSize: 28
            anchors.centerIn: parent
            color: EColor.mainColor(EColor.MColor_1)
        }
    }




    Rectangle{
        id:listviewBg
        width: 210
        height: parent.height-mainIconArea.height
        anchors.top: mainIconArea.bottom
        color: "#222d3c"
        visible: true
        NavExpListView{
            id:navigationBar
            anchors.fill: parent
            clip: true
            Component.onCompleted: {
                initNav()
            }
        }
    }//end listviewBg
    Rectangle{
        id:menuArea
        width: parent.width-listviewBg.width
        height: 56
        anchors.left: listviewBg.right
        anchors.top: parent.top
        color: "white"

        Row{
            height: 40
            anchors.centerIn: parent
            spacing: 6


//            Button{
//                width: 100
//                height: 40
//                onClicked: {
//                    control.value +=2
//                }
//            }
//            Button{
//                width: 100
//                height: 40
//                onClicked: {

//                }
//            }
        }
    }

    DropShadow{//分界线阴影
        anchors.fill: menuArea
        source: menuArea
        color: "#dde1e5"
        radius: 4
        samples: 8
        horizontalOffset: 1
        verticalOffset: 6
        spread: 0
        z:1
    }


    ColorPage{
        anchors.left: listviewBg.right
        anchors.right: parent.right
        anchors.top:menuArea.bottom
        anchors.topMargin: 5
        anchors.bottom: parent.bottom
        visible:navigationBar.currentIndex === 0 && navigationBar.currChildIndex === 0
    }

    ButtonPage{
        anchors.left: listviewBg.right
        anchors.right: parent.right
        anchors.top:menuArea.bottom
        anchors.topMargin: 5
        anchors.bottom: parent.bottom
        visible: navigationBar.currentIndex === 0 && navigationBar.currChildIndex === 1
    }

    RadioButtonPage{
        anchors.left: listviewBg.right
        anchors.right: parent.right
        anchors.top:menuArea.bottom
        anchors.topMargin: 5
        anchors.bottom: parent.bottom
        visible: navigationBar.currentIndex === 1 && navigationBar.currChildIndex === 0
    }

    CheckboxPage{
        anchors.left: listviewBg.right
        anchors.right: parent.right
        anchors.top:menuArea.bottom
        anchors.topMargin: 5
        anchors.bottom: parent.bottom
        visible: navigationBar.currentIndex === 1 && navigationBar.currChildIndex === 1
    }

    InputPage{
        anchors.left: listviewBg.right
        anchors.right: parent.right
        anchors.top:menuArea.bottom
        anchors.topMargin: 5
        anchors.bottom: parent.bottom
        visible: navigationBar.currentIndex === 1 && navigationBar.currChildIndex === 2
    }

    SpinboxPage{
        anchors.left: listviewBg.right
        anchors.right: parent.right
        anchors.top:menuArea.bottom
        anchors.topMargin: 5
        anchors.bottom: parent.bottom
        visible: navigationBar.currentIndex === 1 && navigationBar.currChildIndex === 3
    }

    ComboBoxPage{
        anchors.left: listviewBg.right
        anchors.right: parent.right
        anchors.top:menuArea.bottom
        anchors.topMargin: 5
        anchors.bottom: parent.bottom
        visible: navigationBar.currentIndex === 1 && navigationBar.currChildIndex === 4
    }

    SwitchPage{
        anchors.left: listviewBg.right
        anchors.right: parent.right
        anchors.top:menuArea.bottom
        anchors.topMargin: 5
        anchors.bottom: parent.bottom
        visible: navigationBar.currentIndex === 1 && navigationBar.currChildIndex === 5
    }

    SliderPage{
        anchors.left: listviewBg.right
        anchors.right: parent.right
        anchors.top:menuArea.bottom
        anchors.topMargin: 5
        anchors.bottom: parent.bottom
        visible: navigationBar.currentIndex === 1 && navigationBar.currChildIndex === 6
    }

    ProgressBarPage{
        anchors.left: listviewBg.right
        anchors.right: parent.right
        anchors.top:menuArea.bottom
        anchors.topMargin: 5
        anchors.bottom: parent.bottom
        visible: navigationBar.currentIndex === 2 && navigationBar.currChildIndex === 0
    }
    PaginationPage{
        anchors.left: listviewBg.right
        anchors.right: parent.right
        anchors.top:menuArea.bottom
        anchors.topMargin: 5
        anchors.bottom: parent.bottom
        visible: navigationBar.currentIndex === 2 && navigationBar.currChildIndex === 1
    }
    NoticePage{
        anchors.left: listviewBg.right
        anchors.right: parent.right
        anchors.top:menuArea.bottom
        anchors.topMargin: 5
        anchors.bottom: parent.bottom
        visible: navigationBar.currentIndex === 3 && navigationBar.currChildIndex === 0
    }
    NavigationPage{
        anchors.left: listviewBg.right
        anchors.right: parent.right
        anchors.top:menuArea.bottom
        anchors.topMargin: 5
        anchors.bottom: parent.bottom
        visible: navigationBar.currentIndex === 4 && navigationBar.currChildIndex === 0
    }

    function initNav(){
        var datalist = [{paretObjName:"基础",
                         childenList:[{childObjName:"Color 颜色",parentIndex:0},
                                         {childObjName:"Button 按钮",parentIndex:0}]},
                        {paretObjName:"表单",
                         childenList:[{childObjName:"Radio 单选框",parentIndex:1},
                                      {childObjName:"Checkbox 多选框",parentIndex:1},
                                      {childObjName:"Input 输入框",parentIndex:1},
                                      {childObjName:"SpinBox 计数器",parentIndex:1},
                                      {childObjName:"Combobox 下拉框",parentIndex:1},
                                      {childObjName:"Switch 开关",parentIndex:1},
                                      {childObjName:"Slider 滑块",parentIndex:1}]},
                        {paretObjName:"数据",
                         childenList:[{childObjName:"ProgerssBar 进度条",parentIndex:2},
                                      {childObjName:"Pagination 分页",parentIndex:2}]},
                        {paretObjName:"通知",
                         childenList:[{childObjName:"NoticeCollection 通知合集",parentIndex:3}]},
                        {paretObjName:"导航",
                         childenList:[{childObjName:"Navigation 导航栏",parentIndex:4}]},
                ]
        for(var i = 0;i<datalist.length;++i){
            navigationBar.model.append(datalist[i])
        }
    }
}
